<template>
  <div class="container page">
    <div class="container header">
      <van-nav-bar
          title="兑换详情"
          left-arrow
          @click-left="$router.back()"
      />
    </div>
    <div class="main">
      <div class="item"><span>交易单号:</span>
        <p>{{ detail.id }}</p></div>
      <div class="item"><span>交易时间:</span>
        <p>{{ detail.create_time }}</p></div>
      <div class="item"><span>银行卡名称:</span>
        <p>{{ detail.bankinfo }}</p></div>
      <div class="item"><span>持卡人姓名:</span>
        <p>{{ detail.name }}</p></div>
      <div class="item"><span>银行卡号:</span>
        <p>{{ detail.bankid }}</p></div>
      <div class="item"><span>交易状态:</span>
        <p>{{ detail.status_text }}</p></div>
      <div class="item"><span>兑换积分:</span>
        <p>{{ detail.total_money }}</p></div>
      <div class="item"><span>手续费:</span>
        <p>{{ detail.fee }}</p></div>
      <div class="item"><span>打款积分:</span>
        <p>{{ detail.money }}</p></div>
      <div class="item" v-if="detail.status === 3"><span>系统提示:</span>
        <p v-html="processHTML(detail.desc)"></p></div>
      <!----><!----></div>

  </div>
</template>
<script>
import {Toast} from "vant";
import {getUserWithdrawDetail} from "@api/Withdraw";

export default {
  name: "WithdrawDetail",
  data: function () {
    return {
      id: 0,
      loading: false,
      finished: true,
      refresh: false,
      detail: {}
    }
  },
  created() {
    let that = this;
    if (!this.$route.query.id) {
      Toast.fail({
        message: "无法访问当前页面",
        forbidClick: true,
        duration: 3000,
        onClose: () => {
          that.$router.back();
        }
      })
      return;
    }
    this.id = this.$route.query.id;
    this.initDetail();
  },
  methods: {
    initDetail: function (){
      getUserWithdrawDetail(this.id).then(v =>{
        this.detail = v.data;
      });
    },
    processHTML: function (content){
      content = content.replaceAll("\n", "<br />");
      return content;
    }
  }
};
</script>
<style scoped>
::v-deep .van-nav-bar__left > i, ::v-deep .van-nav-bar__text, ::v-deep .van-nav-bar__title, ::v-deep .van-cell__title {
  color: var(--van-nav-bar-icon-color);
}

.container {
  height: 100vh;
  font-size: .37333rem
}

.container .header {
  height: 1.5rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-around
}

.container .header .van-nav-bar {
  background-color: transparent
}

.container .main {
  display: flex;
  flex-direction: column;
  background-color: #fcf0fa;
  height: calc(100% - 1.5rem);
  overflow: auto
}

.container .main .item {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: .26667rem;
  color: #fa59b5;
  background-color: #f5dcf1
}

.container .main .item span {
  width: 4rem;
  display: block
}

.container .main .item p {
  width: calc(100% - 4rem);
  text-align: right;
  word-wrap: break-word
}
</style>
